import request from './request.js'
//引入request.js配置各种接口
export function LjhLogin(data) {
    return request({
        url: 'login',
        method: 'POST',
        data
    })
}
export function LjhZuo() {
    return request({
        url: 'menus',
        method: 'GET',
    })
}
export function LjhUser(obj) {
    return request({
        url: 'users',
        method: 'GET',
        params: obj
    })
}
export function LjhAdd(data) {
    return request({
        url: 'users',
        method: 'POST',
        data
    })
}
export function LjhXiu(id, data) {
    return request({
        url: `users/${id}`,
        method: 'PUT',
        data
    })
}
export function LjhDel(id) {
    return request({
        url: `users/${id}`,
        method: 'delete',
    })
}
export function LjhTai(uid, type) {
    return request({
        url: `users/${uid}/state/${type}`,
        method: 'PUT',
    })
}
export function LjhFen(id, rid) {
    return request({
        url: `users/${id}/role`,
        method: 'PUT',
        data: { rid }
    })
}
export function LjhJue() {
    return request({
        url: 'roles',
        method: 'GET',
    })
}
export function LjhQuan() {
    return request({
        url: 'rights/list',
        method: 'GET',
    })
}
export function shanQuan(roleid, rightId) {
    return request({
        url: `roles/${roleid}/rights/${rightId}`,
        method: 'delete',
    })
}
export function AddJue(data) {
    return request({
        url: 'roles',
        method: 'POST',
        data
    })
}
export function shanJue(id) {
    return request({
        url: `roles/${id}`,
        method: 'delete',
    })
}
export function shanXiu(id, data) {
    return request({
        url: `roles/${id}`,
        method: 'PUT',
        data
    })
}
export function FenQuan() {
    return request({
        url: 'rights/tree',
        method: 'GET',
    })
}
export function Goodlist(params) {
    return request({
        url: 'goods',
        method: 'GET',
        params
    })
}
export function Xiujue(roleId, rids) {
    return request({
        url: `roles/${roleId}/rights`,
        method: 'POST',
        data: { rids }
    })
}
export function Spshan(id) {
    return request({
        url: `goods/${id}`,
        method: 'delete',
    })
}
export function Splist(type = "3") {
    return request({
        url: 'categories',
        method: 'GET',
        params: { type }
    })
}
export function Spfl(params) {
    return request({
        url: 'categories',
        method: 'GET',
        params
    })
}
export function Sjtj() {
    return request({
        url: 'reports/type/1',
        method: 'GET'
    })
}
export function Flcs(id, sel = "many") {
    return request({
        url: `categories/${id}/attributes`,
        method: 'GET',
        params: { sel }
    })
}
export function addgoods(data) {
    return request({
        url: 'goods',
        method: 'POST',
        data
    })
}
export function Tianjia(data) {
    return request({
        url: 'categories',
        method: 'POST',
        data
    })
}
export function Del(id) {
    return request({
        url: `categories/${id}`,
        method: 'delete',
    })
}
export function Bjfen(id, cat_name) {
    return request({
        url: `categories/${id}`,
        method: 'put',
        data: { cat_name }
    })
}
export function orderstAPI(params) {
    return request({
        url: 'orders',
        method: 'GET',
        params
    })
}
// 删除参数名称
export function Delcan(id, attrid) {
    return request({
        url: `categories/${id}/attributes/${attrid}`,
        method: 'delete',
    })
}
// 编辑提交参数
export function Bjcan(id, attrId, data) {
    return request({
        url: `categories/${id}/attributes/${attrId}`,
        method: 'PUT',
        data
    })
}
// 添加参数
export function Tianjiacan(id, data) {
    return request({
        url: `categories/${id}/attributes`,
        method: 'POST',
        data
    })
}